home *** CD-ROM | disk | FTP | other *** search
/ Programmers Heaven 2 / Programmers Heaven 2.iso / files / windows / ocx / ipack.exe / SRVWIN3.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-06-24  |  8.9 KB  |  276 lines

  1. VERSION 4.00
  2. Begin VB.Form formSession 
  3.    Appearance      =   0  'Flat
  4.    BackColor       =   &H00C0C0C0&
  5.    BorderStyle     =   3  'Fixed Dialog
  6.    Caption         =   "Socket Server Session"
  7.    ClientHeight    =   3405
  8.    ClientLeft      =   2085
  9.    ClientTop       =   2460
  10.    ClientWidth     =   6165
  11.    BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  12.       Name            =   "MS Sans Serif"
  13.       Size            =   8.25
  14.       Charset         =   0
  15.       Weight          =   700
  16.       Underline       =   0   'False
  17.       Italic          =   0   'False
  18.       Strikethrough   =   0   'False
  19.    EndProperty
  20.    ForeColor       =   &H80000008&
  21.    Height          =   3810
  22.    Left            =   2025
  23.    LinkTopic       =   "Form1"
  24.    MDIChild        =   -1  'True
  25.    ScaleHeight     =   3405
  26.    ScaleWidth      =   6165
  27.    Top             =   2115
  28.    Width           =   6285
  29.    Begin VB.TextBox textSocketHandle 
  30.       Appearance      =   0  'Flat
  31.       Height          =   285
  32.       Left            =   600
  33.       TabIndex        =   1
  34.       Text            =   "Text1"
  35.       Top             =   3000
  36.       Visible         =   0   'False
  37.       Width           =   645
  38.    End
  39.    Begin VB.ListBox listTranscript 
  40.       Appearance      =   0  'Flat
  41.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  42.          Name            =   "MS Sans Serif"
  43.          Size            =   8.25
  44.          Charset         =   0
  45.          Weight          =   400
  46.          Underline       =   0   'False
  47.          Italic          =   0   'False
  48.          Strikethrough   =   0   'False
  49.       EndProperty
  50.       Height          =   1590
  51.       Left            =   105
  52.       MultiSelect     =   1  'Simple
  53.       TabIndex        =   0
  54.       TabStop         =   0   'False
  55.       Top             =   600
  56.       Width           =   5940
  57.    End
  58.    Begin VB.TextBox textMessageEntry 
  59.       Appearance      =   0  'Flat
  60.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  61.          Name            =   "MS Sans Serif"
  62.          Size            =   8.25
  63.          Charset         =   0
  64.          Weight          =   400
  65.          Underline       =   0   'False
  66.          Italic          =   0   'False
  67.          Strikethrough   =   0   'False
  68.       EndProperty
  69.       Height          =   705
  70.       Left            =   1380
  71.       MultiLine       =   -1  'True
  72.       TabIndex        =   4
  73.       Top             =   2520
  74.       Width           =   4665
  75.    End
  76.    Begin VB.Label Label6 
  77.       Alignment       =   1  'Right Justify
  78.       Caption         =   "Client Port:"
  79.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  80.          Name            =   "MS Sans Serif"
  81.          Size            =   8.25
  82.          Charset         =   0
  83.          Weight          =   400
  84.          Underline       =   0   'False
  85.          Italic          =   0   'False
  86.          Strikethrough   =   0   'False
  87.       EndProperty
  88.       Height          =   255
  89.       Left            =   3600
  90.       TabIndex        =   8
  91.       Top             =   240
  92.       Width           =   975
  93.    End
  94.    Begin VB.Label Label5 
  95.       Alignment       =   1  'Right Justify
  96.       Caption         =   "Client IP:"
  97.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  98.          Name            =   "MS Sans Serif"
  99.          Size            =   8.25
  100.          Charset         =   0
  101.          Weight          =   400
  102.          Underline       =   0   'False
  103.          Italic          =   0   'False
  104.          Strikethrough   =   0   'False
  105.       EndProperty
  106.       Height          =   255
  107.       Left            =   3600
  108.       TabIndex        =   7
  109.       Top             =   0
  110.       Width           =   975
  111.    End
  112.    Begin VB.Label lblClientPort 
  113.       Caption         =   "0"
  114.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  115.          Name            =   "MS Sans Serif"
  116.          Size            =   8.25
  117.          Charset         =   0
  118.          Weight          =   400
  119.          Underline       =   0   'False
  120.          Italic          =   0   'False
  121.          Strikethrough   =   0   'False
  122.       EndProperty
  123.       Height          =   255
  124.       Left            =   4680
  125.       TabIndex        =   6
  126.       Top             =   240
  127.       Width           =   1095
  128.    End
  129.    Begin VB.Label lblClientIP 
  130.       Caption         =   "0.0.0.0"
  131.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  132.          Name            =   "MS Sans Serif"
  133.          Size            =   8.25
  134.          Charset         =   0
  135.          Weight          =   400
  136.          Underline       =   0   'False
  137.          Italic          =   0   'False
  138.          Strikethrough   =   0   'False
  139.       EndProperty
  140.       Height          =   255
  141.       Left            =   4680
  142.       TabIndex        =   5
  143.       Top             =   0
  144.       Width           =   1335
  145.    End
  146.    Begin AsocketLib.AsyncSocket AsyncSocket1 
  147.       Left            =   0
  148.       Top             =   2760
  149.       _Version        =   327680
  150.       _ExtentX        =   847
  151.       _ExtentY        =   847
  152.       _StockProps     =   0
  153.       ReceiveBufferSize=   8192
  154.       SendBufferSize  =   8192
  155.       BroadcastEnabled=   0   'False
  156.       LingerEnabled   =   0   'False
  157.       RouteEnabled    =   -1  'True
  158.       KeepAliveEnabled=   0   'False
  159.       OutOfBandEnabled=   0   'False
  160.       ReuseAddressEnabled=   0   'False
  161.       TCPNoDelayEnabled=   0   'False
  162.       LingerMode      =   0
  163.       LingerTime      =   0
  164.       EventMask       =   63
  165.       LocalPort       =   0
  166.       RemotePort      =   0
  167.       SocketType      =   0
  168.       LocalAddress    =   ""
  169.       RemoteName      =   ""
  170.       RemoteAddress   =   ""
  171.       ReceiveTimeout  =   -1
  172.       SendTimeout     =   -1
  173.    End
  174.    Begin VB.Label Label2 
  175.       Appearance      =   0  'Flat
  176.       BackColor       =   &H00C0C0C0&
  177.       Caption         =   "Transcript:"
  178.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  179.          Name            =   "MS Sans Serif"
  180.          Size            =   8.25
  181.          Charset         =   0
  182.          Weight          =   400
  183.          Underline       =   0   'False
  184.          Italic          =   0   'False
  185.          Strikethrough   =   0   'False
  186.       EndProperty
  187.       ForeColor       =   &H80000008&
  188.       Height          =   225
  189.       Left            =   75
  190.       TabIndex        =   2
  191.       Top             =   240
  192.       Width           =   810
  193.    End
  194.    Begin VB.Line Line2 
  195.       BorderColor     =   &H00FFFFFF&
  196.       X1              =   -15
  197.       X2              =   7800
  198.       Y1              =   2400
  199.       Y2              =   2400
  200.    End
  201.    Begin VB.Line Line1 
  202.       BorderColor     =   &H00808080&
  203.       X1              =   0
  204.       X2              =   7815
  205.       Y1              =   2360
  206.       Y2              =   2360
  207.    End
  208.    Begin VB.Label Label1 
  209.       Alignment       =   1  'Right Justify
  210.       Appearance      =   0  'Flat
  211.       BackColor       =   &H00C0C0C0&
  212.       Caption         =   "Enter Message:"
  213.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  214.          Name            =   "MS Sans Serif"
  215.          Size            =   8.25
  216.          Charset         =   0
  217.          Weight          =   400
  218.          Underline       =   0   'False
  219.          Italic          =   0   'False
  220.          Strikethrough   =   0   'False
  221.       EndProperty
  222.       ForeColor       =   &H80000008&
  223.       Height          =   285
  224.       Left            =   105
  225.       TabIndex        =   3
  226.       Top             =   2520
  227.       Width           =   1215
  228.    End
  229. Attribute VB_Name = "formSession"
  230. Attribute VB_Creatable = False
  231. Attribute VB_Exposed = False
  232. Option Explicit
  233. Private Sub AsyncSocket1_OnClose(ByVal ErrorCode As Integer)
  234.     AsyncSocket1.Action = ASocketClose
  235.     Unload Me
  236. End Sub
  237. Private Sub AsyncSocket1_OnReceive(ByVal ErrorCode As Integer)
  238.     Dim t As String
  239.     '
  240.     ' Receive data available, get it
  241.     '
  242.     AsyncSocket1.Action = ASocketReceive
  243.     t = AsyncSocket1.ReceiveBuffer
  244.     '
  245.     ' Echo to client
  246.     '
  247.     AsyncSocket1.SendBuffer = t
  248.     AsyncSocket1.Action = ASocketSend
  249.     '
  250.     ' Add to transcript
  251.     '
  252.     If (Len(t) = 1 And Asc(t) = 13) Then
  253.         t = ""
  254.     End If
  255.     listTranscript.AddItem "recv: " & t
  256.     listTranscript.ListIndex = listTranscript.ListCount - 1
  257. End Sub
  258. Private Sub textMessageEntry_KeyPress(KeyAscii As Integer)
  259.     Dim t As String
  260.     If (KeyAscii = 13) Then
  261.         t = textMessageEntry.Text
  262.         listTranscript.AddItem "send: " & t
  263.         listTranscript.ListIndex = listTranscript.ListCount - 1
  264.         If (t = "") Then
  265.             t = Chr$(KeyAscii)
  266.         End If
  267.         AsyncSocket1.SendBuffer = t
  268.         AsyncSocket1.Action = ASocketSend
  269.         textMessageEntry.Text = ""
  270.         KeyAscii = 0
  271.     End If
  272. End Sub
  273. Private Sub textSocketHandle_Change()
  274.     AsyncSocket1.Socket = CLng(textSocketHandle.Text)
  275. End Sub
  276.